package org.example.admincontroller;

import org.example.adminservice.AdminService;
import org.example.pojo.Result;
import org.example.pojo.admindto.AdminRegisterDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/register")
public class AdminRegisterController {

    @Autowired
    private AdminService adminService;

    @PostMapping
    public Result register(@RequestBody AdminRegisterDTO adminRegisterDTO) {
        if(adminService.register(adminRegisterDTO)) {
            return Result.success();
        }else{
            return Result.error("不存在授权人！");
        }
    }

}
